package com.qingke.easyjava.jdbc.command.impl;

import com.qingke.easyjava.jdbc.command.PlayerCommand;
import com.qingke.easyjava.jdbc.pojo.Player;
import com.qingke.easyjava.jdbc.util.QingkeConsole;

public class ScoreCommand extends PlayerCommand {

	public ScoreCommand(Player playerProfile) {
		super(playerProfile);
	}

	@Override
	public void execute() {
		QingkeConsole.println("==== " + playerProfile.getUsername() + " ====");
		QingkeConsole.println("= Total questions:" + playerProfile.getQuestions().size());
		QingkeConsole.println("= Total answers:" + playerProfile.getAnswers().size());
		QingkeConsole.println("= Total score:" + playerProfile.getScore());
		
		int score = playerProfile.getScore();
		
		String level = "loser";
		if(score > 100) {
			level = "Superb";
		}else if(score > 60) {
			level = "Fair";
		}else if (score > 30){
			level = "Starter";
		}
		
		QingkeConsole.println("= Level : " + level);
	}

}
